﻿using System;
using System.Net;
using SomeKit.Http;
using System.Collections.Generic;

#if WINDOWS_PHONE
using Microsoft.Phone.Reactive;
#else
using System.Linq;
#endif


namespace SomeKit.Rx.Http
{
    public static partial class HttpHelper
    {
        public static IObservable<string> Delete(this Uri uri, Action<HttpWebRequest> headerHandler = null)
        {
            var request = uri.GetRequest(SomeKit.Http.HttpHelper.Verbs.DELETE, headerHandler);
            return Observable.FromAsyncPattern<WebResponse>(request.BeginGetResponse, request.EndGetResponse)().Select(r => r.WebResponseAsString());
        }
    }
}
